package org.bigzero.bao

import grails.test.*

class UserControllerTests extends ControllerUnitTestCase {
	protected void setUp() {
		super.setUp()
		
	}

	protected void tearDown() {
		super.tearDown()
	}

	void testLogin() {
		def jordan = new User(name:"jordan", password:"bulls23", role:"Boss")
		def kobe = new User(name:"kobe", password:"lakers24", role:"Operator")
		def yao = new User(name:"yao", password:"rocket11", role:"Admin")
		mockDomain(User, [jordan, kobe, yao])
		controller.params.name = "jordan"
		controller.params.password = "bulls23"
		controller.login()
		assertNotNull controller.session.user
		assertEquals "jordan", controller.session.user.name
		assertEquals "Boss", controller.session.user.role
	}
}
